import typing
import time


class listNode:

    def __init__(self, m):
        self.value = m
        self.next = None


def list2pList(ls: list):
    length = len(ls)

    if length < 1:
        return None

    head = listNode(ls[0])
    if length == 1:
        return head
    else:
        pNode = listNode(ls[1])
        head.next = pNode
        for i in range(2, length):
            pNode.next = listNode(ls[i])
            pNode = pNode.next
    return head

def print_List_node(head:listNode):
    if not head:
        return
    p_node = head
    while p_node is not None:
        print(p_node.value,end=',')
        p_node = p_node.next
    print()

class TreeNode:
    def __init__(self, val):
        self.value = val
        self.leftchild = None
        self.rightchild = None
        self.parant = None


def preorder(root: TreeNode):
    # 前序遍历二叉树
    if root is not None:
        print(root.value, end=' ')
    else:
        return
    preorder(root.leftchild)
    preorder(root.rightchild)


class Stack:
    def __init__(self):
        self.list = []

    def push(self, val):
        self.list.append(val)

    def popout(self):
        return self.list.pop()

    def isNone(self):
        # 判断栈是否为空
        # 如果为空则返回True,否则返回False
        return not self.list

def running_time(f):

    def decored(*args, **kwargs):
        start_time = time.time()
        res = f(*args, **kwargs)
        end_time = time.time()
        print(' {0} using time : {1}'.format(f.__name__, end_time-start_time))
        return res
    return decored







if __name__ == "__main__":
    ls = list(range(10))
    print(ls)
    p_list = list2pList(ls)

    while p_list is not None:
        print(p_list.value, end='->')
        p_list = p_list.next
